//
//  PopComponent.h
//  分享demo
//
//  Created by pc-chtypd056 on 2018/8/21.
//  Copyright © 2018年 CTL. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, CTLActionStyle) {
    CTLActionStyleDefault = 0,
    CTLActionStyleCancel,
};

typedef NS_ENUM(NSInteger, CTLPopComponentStyle) {
    CTLPopComponentStyleActionSheet,
    CTLPopComponentStyleActionAlert
};

@interface CTLAction : NSObject

+ (instancetype)actionWithTitle:(NSString *)title style:(CTLActionStyle)style handlerComplete:(void(^)(CTLAction *action))handleComplete;

/** Title */
@property (nonatomic, strong) NSString *title;
/** style */
@property (nonatomic, assign) CTLActionStyle style;
/** 回调 */
@property (nonatomic, copy) void(^aHandleComplete)(CTLAction *action);
@end

@protocol PopComponentDelegate <NSObject>

@optional
- (void)show;
- (void)dismiss;

- (void)showWithCompletion:(dispatch_block_t)complete;
- (void)dismissWithCompletion:(dispatch_block_t)complete;
- (void)addAction:(CTLAction *)action;

@end

@interface PopComponent : UIView<PopComponentDelegate>

+ (instancetype)popComponentWihtTitle:(NSString *)title message:(NSString *)message style:(CTLPopComponentStyle)style;
/** Title */
@property (nonatomic, strong) NSString *title;
/** style */
@property (nonatomic, assign) CTLPopComponentStyle style;
/** message */
@property (nonatomic, strong) NSString *message;

@end
